<template>
  <div id="dialogNum">
    <el-dialog
      title="包含内容数"
      :visible.sync="dialogData.isShow"
      width="200px"
      :before-close="labelHandleClose"
    >
      内容数：{{ getContNum }} 条
    </el-dialog>
  </div>
</template>

<script>
import { getContNum } from '@/api/contentTags/configureTation'
import { getCont } from '@/api/contentTags/hotTopic'
export default {
  name: 'dialogNum',
  msg: '标签配置/推荐-包含内容数',
  props: ['dialogData'],
  data() {
    return {
      getContNum: ''
    }
  },
  mounted() {
    if (this.dialogData.id) {
      this.getCount()
    } else {
      this.getContentNum()
    }
  },
  methods: {
    /*获取包含内容数*/
    getCount() {
      getContNum(
        this.dialogData.id,
        (response) => {
          this.getContNum = response
        },
        (response) => {
          this.$message.warning('获取内容数失败,' + response.message)
          this.loading = false
        }
      )
    },
    getContentNum() {
      getCont(
        this.dialogData.topicId,
        (response) => {
          this.getContNum = response
        },
        (response) => {
          this.$message.warning('获取内容数失败,' + response.message)
          this.loading = false
        }
      )
    },
    labelHandleClose(done) {
      this.cancelLabel()
      done()
    },
    cancelLabel() {
      // 关闭前清空
      this.loading = false
      this.dialogData.id = ''
      this.dialogData.isShow = false
    }
  }
}
</script>

<style lang="less">
#dialogNum {
}
</style>
